<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    一.字符串支持正则方法
    1.split() :将字符串转换为数组,利用正则进行转换
    <script>
        let str="a1234567vdfgfds5555df88ds";
        console.log(str.split(/\d+/));//['a', 'vdfgfds', 'df', 'ds']
        // \d 匹配数字 
    </script>

    2.replace():替换字符串,第一个参数可以是正则(被替换的字符串),第二个参数:替换后的字符串或者函数
    <script>
        let str1="这件衣服是你妈妈的还是你妈妈妹妹的我猜是你大爷的";
        console.log(str1.replace(/妈妈|妹妹|大爷/g,"****"));
    </script>

    3.match():把字符串中符合条件的内容捕获出来,返回数组格式
    <script>
        let str2="f000FEFEWEwfewf我234543喜fewfw欢jiefjweiof000234陈书凡879898fufufu";
        console.log(str2.match(/[0-9]+/g));
        console.log(str2.match(/[a-z]+/g));
        console.log(str2.match(/[A-Z]+/g));
        console.log(str2.match(/[\u4e00-\u9fa5]+/g));
    </script>

    4.search()
</body>
</html>